package com.jtny.nytb.config.measurementtype.service;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.jtny.component.entity.PageData;
import com.jtny.component.exception.ServiceException;
import com.jtny.nytb.config.measurementtype.dto.MeasurementTypeDTO;
import com.jtny.nytb.config.measurementtype.dto.MeasurementTypePageQueryDTO;
import com.jtny.nytb.config.measurementtype.dto.RepeatMeasurementTypeDTO;
import com.jtny.nytb.config.measurementtype.vo.MeasurementTypePageQueryParamVO;
import com.jtny.nytb.config.measurementtype.vo.MeasurementTypeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 计量单位分类Service接口
 * @package com.jtny.nytb.config.measurementType.service
 * @fileName MeasurementTypeService.java
 * @author 智慧能源中心 - lyq
 * @createTime 2023年9月01日 09:16
 * @Copyright© 2023 jtny
 * 江投能源技术研究院 版权所有
 */
@Api(value = " 计量单位分类信息服务Api接口", tags = "计量单位分类信息服务Api接口")
@Service
public interface MeasurementTypeService {

    /**
     * 保存计量单位分类信息
     * @param measurementTypeDTO 计量单位分类信息DTO对象
     * @return 返回保存后的计量单位分类信息DTO对象
     * @throws ServiceException 抛出异常
     */
    @ApiOperation("保存计量单位分类信息")
    @ApiImplicitParam(name = "measurementTypeDTO", value = "计量单位分类信息DTO对象", required = true, paramType = "query")
    @ApiOperationSupport(order = 1)
    @PostMapping("/save")
    @ResponseBody
    MeasurementTypeDTO save(@RequestBody MeasurementTypeDTO measurementTypeDTO) throws ServiceException;

    /**
     * 修改计量单位分类信息
     * @param measurementTypeDTO 计量单位分类信息DTO对象
     * @throws ServiceException 抛出异常
     */
    @ApiOperation("修改计量单位分类信息")
    @ApiImplicitParam(name = "measurementTypeDTO", value = "计量单位分类信息DTO对象", required = true, paramType = "query")
    @ApiOperationSupport(order = 2)
    @PutMapping("/update")
    @ResponseBody
    void update(@RequestBody MeasurementTypeDTO measurementTypeDTO) throws ServiceException;

    /**
     * 通过主键id获取计量单位分类信息
     * @param id 主键id
     * @return 返回计量单位分类信息
     */
    @ApiOperation("通过主键id获取计量单位分类信息")
    @ApiImplicitParam(name = "id", value = "主键id", required = true, paramType = "path")
    @ApiOperationSupport(order = 3)
    @RequestMapping("/getById/{id}")
    @ResponseBody
    MeasurementTypeDTO getById(@PathVariable("id") Long id);

    PageData<MeasurementTypeVO> queryByPage(MeasurementTypePageQueryParamVO measurementTypePageQueryParamVO) throws ServiceException;

    /**
     * 分页查询计量单位分类信息
     * @param measurementTypePageQueryParamVO 分页查询参数DTO对象
     * @return 返回计量单位分类信息分页查询结果PageData对象
     */
    @ApiOperation("分页查询计量单位分类信息")
    @ApiImplicitParam(name = "measurementTypePageQueryDTO", value = "分页查询参数DTO对象", required = true, paramType = "query")
    @ApiOperationSupport(order = 4)
    @PostMapping("/queryPage")
    @ResponseBody
    PageData<MeasurementTypeDTO> queryPage(@RequestBody MeasurementTypePageQueryDTO measurementTypePageQueryParamVO);

    /**
     * 根据计量单位分类名称查询计量单位分类信息
     * @param repeatMeasurementTypeDTO 计量单位分类查重信息
     * @return 计量单位分类信息
     */
    @ApiOperation("根据计量单位分类名称查询计量单位分类信息")
    @ApiImplicitParam(name = "repeatMeasurementTypeDTO", value = "计量单位分类查重信息", required = true, paramType = "query")
    @ApiOperationSupport(order = 5)
    @PostMapping("/queryMeasurementTypeByName")
    @ResponseBody
    List<MeasurementTypeDTO> queryMeasurementTypeByName(@RequestBody RepeatMeasurementTypeDTO repeatMeasurementTypeDTO);

    /**
     * 根据计量单位分类编号查询计量单位分类信息
     * @param repeatMeasurementTypeDTO 计量单位分类查重信息
     * @return 计量单位分类信息
     */
    @ApiOperation("根据计量单位分类编号查询计量单位分类信息")
    @ApiImplicitParam(name = "repeatMeasurementTypeDTO", value = "计量单位查重信息", required = true, paramType = "query")
    @ApiOperationSupport(order = 6)
    @PostMapping("/queryMeasurementTypeByCode")
    @ResponseBody
    List<MeasurementTypeDTO> queryMeasurementTypeByCode(@RequestBody RepeatMeasurementTypeDTO repeatMeasurementTypeDTO);

    /**
     * 获取所有计量单位分类的信息
     * @return 计量单位分类信息列表
     */
    @ApiOperation("获取所有计量单位分类的信息")
    @ApiOperationSupport(order = 7)
    @PostMapping("/queryAll")
    @ResponseBody
    List<MeasurementTypeVO> queryAll();


    /**
     * 根据名称获取计量单位分类信息
     *
     * @param measurementTypeNameList 计量单位分类名称列表
     * @return 计量单位分类信息Map key: 计量单位分类名称 value: 计量单位分类信息
     */
    @ApiOperation("根据名称获取计量单位分类信息")
    @ApiImplicitParam(name = "measurementTypeNameList", value = "计量单位分类名称列表", required = true, paramType = "query")
    @ApiOperationSupport(order = 8)
    @PostMapping("/mapMeasurementTypeByName")
    @ResponseBody
    Map<String, MeasurementTypeDTO> mapMeasurementTypeByName(@RequestBody List<String> measurementTypeNameList);

    /**
     * 新增计量单位分类操作
     * @param measurementTypeVO 计量单位分类VO对象
     * @return 计量单位分类VO对象
     * @throws ServiceException 抛出异常
     */
    MeasurementTypeVO saveMeasurementType(MeasurementTypeVO measurementTypeVO) throws ServiceException;

    /**
     * 查询计量单位分类操作
     * @param measurementTypeId 计量单位分类ID
     * @return 计量单位分类VO对象
     * @throws ServiceException 抛出异常
     */
    MeasurementTypeVO detailMeasurementType(Long measurementTypeId) throws ServiceException;

    /**
     * 更新计量单位分类操作
     * @param measurementTypeVO 计量单位分类VO对象
     * @throws ServiceException 抛出异常
     */
    void updateMeasurementType(MeasurementTypeVO measurementTypeVO) throws ServiceException;
    /**
     * 删除计量单位分类
     * @param measurementTypeId 计量单位分类Id
     * @throws ServiceException 抛出异常
     */
    void deleteMeasurementType(Long measurementTypeId) throws ServiceException;

    /**
     * 禁用计量单位分类
     * @param measurementTypeId 计量单位分类Id
     * @throws ServiceException 抛出异常
     */
    void disableMeasurementType(Long measurementTypeId) throws ServiceException;
    /**
     * 启用计量单位分类
     * @param measurementTypeId 计量单位分类Id
     * @throws ServiceException 抛出异常
     */
    void enableMeasurementType(Long measurementTypeId) throws ServiceException;
}
